// To parse this JSON data, do
//
//     final userGuideListModel = userGuideListModelFromJson(jsonString);

import 'dart:convert';

UserGuideListModel userGuideListModelFromJson(String str) =>
    UserGuideListModel.fromJson(json.decode(str));

String userGuideListModelToJson(UserGuideListModel data) =>
    json.encode(data.toJson());

class UserGuideListModel {
  UserGuideListModel({
    required this.meta,
    required this.list,
  });

  Meta meta;
  List<ListElement> list;

  factory UserGuideListModel.fromJson(Map<String, dynamic> json) =>
      UserGuideListModel(
        meta: Meta.fromJson(json["meta"]),
        list: List<ListElement>.from(
            json["list"].map((x) => ListElement.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
    "meta": meta.toJson(),
    "list": List<dynamic>.from(list.map((x) => x.toJson())),
  };
}

class ListElement {
  ListElement({
    required this.id,
    required this.logo,
    required this.caption,
    required this.tag,
    required this.startCity,
    required this.startCityName,
    required this.endCity,
    required this.endCityName,
    required this.totalDay,
    required this.clickNum,
    required this.distance,
    required this.hasVideo,
    required this.unfinished,
  });

  int id;
  String logo;
  String caption;
  bool hasVideo;
  bool unfinished;
  List<String>? tag;
  var startCity;
  var startCityName;
  var endCity;
  var endCityName;
  double totalDay;
  var clickNum;
  var distance;

  factory ListElement.fromJson(Map<String, dynamic> json) => ListElement(
    id: json["id"],
    logo: json["logo"],
    caption: json["caption"],
    hasVideo:json["hasVideo"] ?? false,
    unfinished: json["unfinished"]??false,
    tag: json["tag"] == null
        ? null
        : List<String>.from(json["tag"].map((x) => x)),
    startCity: json["startCity"],
    endCity: json["endCity"],
    totalDay: json["totalDay"] == null ?1: json["totalDay"]?.toDouble(),
    clickNum: json["clickNum"],
    distance: json["distance"],
    startCityName: json["startCityName"],
    endCityName: json["endCityName"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "logo": logo,
    "caption": caption,
    "tag": List<dynamic>.from(tag!.map((x) => x)),
    "startCity": startCity,
    "endCity": endCity,
    "totalDay": totalDay,
    "clickNum": clickNum,
    "distance": distance,
    "startCityName": startCityName,
    "endCityName": endCityName,
    "unfinished": unfinished,
    "hasVideo": hasVideo,
  };
}

class Meta {
  Meta({
    required this.currentPage,
    required this.maxPage,
    required this.itemCount,
    required this.pageSize,
  });

  int currentPage;
  int maxPage;
  int itemCount;
  int pageSize;

  factory Meta.fromJson(Map<String, dynamic> json) => Meta(
    currentPage: json["currentPage"],
    maxPage: json["maxPage"],
    itemCount: json["itemCount"],
    pageSize: json["pageSize"],
  );

  Map<String, dynamic> toJson() => {
    "currentPage": currentPage,
    "maxPage": maxPage,
    "itemCount": itemCount,
    "pageSize": pageSize,
  };
}
